using System;
using System.Collections.Generic;
using System.Text;

namespace GoogleNet
{
    /// <summary>
    /// Specifies the drawing style (color, color mode, and line width) for all line geometry. 
    /// Line geometry includes the outlines of outlined polygons and the extruded "tether" 
    /// of Placemark icons (if extrusion is enabled). 
    /// </summary>
    public class KmlLineStyle : KmlColorStyle
    {
        private string tagName = "LineStyle";

        #region Width
        private int width = 1;

        /// <summary>
        /// Width of the line, in pixels (default = 1).
        /// </summary>
        /// <value>The width.</value>
        public int Width
        {
            get { return width; }
            set { width = value; }
        } 
        #endregion
        
        #region IKmlElement Members

        /// <summary>
        /// Name of the KML tag for this specific element.
        /// </summary>
        /// <value></value>
        /// <returns></returns>
        public override string TagName
        {
            get { return tagName; }
        }

        #endregion

        #region IKmlGenerator Members

        /// <summary>
        /// Generates the KML for this element including its child elements.
        /// </summary>
        /// <param name="writer">The XML writer that will be used to generate the KML.</param>
        public override void GenerateKml(System.Xml.XmlTextWriter writer)
        {
            writer.WriteStartElement(tagName);
            base.GenerateKml(writer);

            if (width != 1)
                writer.WriteElementString("width", width.ToString());

            writer.WriteEndElement();
        }

        #endregion
    }
}
